#coding=utf-8
import pyDes,binascii

DESKEY='ADCFE653'
class DesCoding:
    _instance = pyDes.des(DESKEY,pad=None,padmode=pyDes.PAD_PKCS5)
    @staticmethod
    def encode(data):
        br = DesCoding._instance.encrypt(data)
        return binascii.b2a_hex(br).upper()

    @staticmethod
    def decode(data):
        br = binascii.a2b_hex(data)
        return DesCoding._instance.decrypt(br)


if __name__=='__main__':
    a= DesCoding.encode('1324')
    print a
    print DesCoding.decode(a)
